package com.mgface.springdata.repository;

import com.mgface.springdata.entity.Article;
import org.bson.types.ObjectId;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.mongodb.repository.MongoRepository;
import org.springframework.data.mongodb.repository.Query;
import org.springframework.stereotype.Repository;

/**
 * @author wanyuxiang
 * @version 1.0
 * @project springdataCollection
 * @create 2018-08-17 15:15
 **/
@Repository
public interface ArticleRepository extends MongoRepository<Article, ObjectId> {
    @Query(value = "{'name':?0}",fields = "{'name':1}")
    Page<Article> myQuery(String name, Pageable pageable);
}
